package simpleTaskDispatcher.model.tasks;

import simpleTaskDispatcher.model.tasks.impl.ContextFreeTask;
import simpleTaskDispatcher.model.tasks.impl.SetParameterTask;

public class ParameterTasks {

	public static ITask set(final String parameter, final Object value) {
		return new SetParameterTask(parameter, value);
	}
	
	public static ITask incrementInteger(final String parameter, final int amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedIntegerParameter(parameter, amount);
			}
		};
	}
	
	public static ITask incrementDouble(final String parameter, final double amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedDoubleParameter(parameter, amount);
			}
		};
	}
	
	public static ITask incrementLong(final String parameter, final long amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedLongParameter(parameter, amount);
			}
		};
	}
	
	public static ITask incrementFloat(final String parameter, final float amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedFloatParameter(parameter, amount);
			}
		};
	}
	
	public static ITask incrementInteger(final String parameter) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedIntegerParameter(parameter, 1);
			}
		};
	}
	
	public static ITask incrementDouble(final String parameter) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedDoubleParameter(parameter, 1.0);
			}
		};
	}
	
	public static ITask incrementLong(final String parameter) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedLongParameter(parameter, 1l);
			}
		};
	}
	
	public static ITask incrementFloat(final String parameter) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedFloatParameter(parameter, 1f);
			}
		};
	}
	
	
	public static ITask decrementInteger(final String parameter) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedIntegerParameter(parameter, -1);
			}
		};
	}
	
	public static ITask decrementDouble(final String parameter) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedDoubleParameter(parameter, -1.0);
			}
		};
	}
	
	public static ITask decrementLong(final String parameter) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedLongParameter(parameter, -1l);
			}
		};
	}
	
	public static ITask decrementFloat(final String parameter) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedFloatParameter(parameter, -1f);
			}
		};
	}
	
	public static ITask decrementInteger(final String parameter, final int amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedIntegerParameter(parameter, -1 * amount);
			}
		};
	}
	
	public static ITask decrementDouble(final String parameter, final double amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedDoubleParameter(parameter, -1.0 * amount);
			}
		};
	}
	
	public static ITask decrementLong(final String parameter, final long amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedLongParameter(parameter, -1l * amount);
			}
		};
	}
	
	public static ITask decrementFloat(final String parameter, final float amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				incrementSharedFloatParameter(parameter, -1f * amount);
			}
		};
	}
	
	public static ITask multiplyInteger(final String parameter, final int amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				multiplySharedIntegerParameter(parameter, amount);
			}
		};
	}
	
	public static ITask multiplyDouble(final String parameter, final double amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				multiplySharedDoubleParameter(parameter, amount);
			}
		};
	}
	
	public static ITask multiplyLong(final String parameter, final long amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				multiplySharedLongParameter(parameter, amount);
			}
		};
	}
	
	public static ITask multiplyFloat(final String parameter, final float amount) {
		return new ContextFreeTask() {
			
			@Override
			public void execute() throws InterruptedException {
				multiplySharedFloatParameter(parameter, amount);
			}
		};
	}
	
}
